package org.i1510.spider.job;
import java.util.Map;

import org.i1510.common.utils.DateUtils;
import org.i1510.common.utils.StringUtils;
import org.i1510.spider.bean.SysSpiderRuleBean;
import org.i1510.spider.utils.spiderExt.SpiderRuleRun;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
  
/**
 * @author Administrator
 * 采集http://caibaojian.com/c/code
 */
public class JobSpider implements Job {  
  
    public void execute(JobExecutionContext context) throws JobExecutionException { 
    	System.out.println("采集任务开始-->["+DateUtils.getNow()+"]");
        System.out.println("上一次任务执行时间: " + DateUtils.convertDateToString(context.getPreviousFireTime(), DateUtils.PATTERN_DATETIME));  
        System.out.println("当前任务执行时间: " + DateUtils.convertDateToString(context.getFireTime(), DateUtils.PATTERN_DATETIME));  
        System.out.println("下一次任务执行时间: " + DateUtils.convertDateToString(context.getNextFireTime(), DateUtils.PATTERN_DATETIME));  
        Map properties = context.getJobDetail().getJobDataMap();  
        String pageNo = StringUtils.object2string(properties.get("pageNo"), "1");
        //执行页面抓取
		SpiderRuleRun srr = new SpiderRuleRun();
		SysSpiderRuleBean[] jobCBJ = srr.jobCBJ(3);
		SpiderRuleRun.run(jobCBJ);
        System.out.println("采集任务结束-->["+DateUtils.getNow()+"]");
       
        
    }  
} 